package com.itheima.test;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.File;
import java.io.IOException;

public class JsoupDemo {
    public static void main(String[] args) throws IOException {
        //1. 解析xml文件,获取document对象
        File file = new File(JsoupDemo.class.getClassLoader().getResource("student.xml").getPath());
        Document document = Jsoup.parse(file, "UTF-8");

        Elements elements = document.getElementsByTag("name");
        Element element = elements.get(1);
        String text = element.text();
        System.out.println(text);

    }
}
